﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Job.Core
{
    /// <summary>
    /// 通用结果集
    /// </summary>
    /// <typeparam name="T"></typeparam>
    [Serializable]
    public class SearchResult<T> : SearchQuery
    {
        // Fields
        private float a;
        private List<T> c;

        /// <summary>
        /// 通用结果集
        /// </summary>
        public SearchResult()
        {
            this.a = 0;
            this.c = new List<T>();
        }

        /// <summary>
        /// 通用结果集
        /// </summary>
        public SearchResult(SearchQuery Query)
            : this()
        {
            this.PageIndex = Query.PageIndex;
            this.PageSize = Query.PageSize;
        }

        /// <summary>
        /// 是否有结果
        /// </summary>
        public bool HasResults
        {
            get
            {
                return (c != null && c.Count > 0) ? true : false;
            }
        }

        /// <summary>
        /// 结果集
        /// </summary>
        public List<T> Records
        {
            get
            {
                return c;
            }
            set
            {
                this.c = value;
            }
        }
        
        /// <summary>
        /// 消耗时间
        /// </summary>
        public float SearchDuration
        {
            get
            {
                return this.a;
            }
            set
            {
                this.a = value;
            }
        }

    }
    

}